define(['swiper','pages/index/model'],function(Swiper,model){
	var swiper;
	return {
		init:function(){
			if(!swiper){
				swiper=new Swiper('#swiper-container', {
			    //paginationClickable: true,
				    centeredSlides: true,
				    slidesPerView:1.5,
					direction:'vertical',
					nextButton: '.swiper-next',
		            prevButton: '.swiper-prev',
					onSlideChangeEnd: function(swiper){
				      	var activeIndex=swiper.activeIndex,
				      	    slide=swiper.slides[activeIndex];
	
				      	model.code=$(slide).attr('goodscode');
				    },
				    watchActiveIndex: true
				});
				swiper.slideTo(swiper.slides.length>1?1:0);
			}
		},
		getSwiper:function(){return swiper;}
	}
});